package com.aosan.website.common.core.config

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor
import com.baomidou.mybatisplus.extension.plugins.pagination.optimize.JsqlParserCountOptimize
import org.mybatis.spring.annotation.MapperScan
import org.springframework.context.annotation.Bean

/**
 * MyBatisPlus 相关配置
 */
@MapperScan("com.aosan.website.*.mapper")
open class MybatisPlusConfig {

    /**
     * 分页插件
     */
    @Bean
    open fun paginationInterceptor(): PaginationInterceptor {
        val paginationInterceptor = PaginationInterceptor()
        paginationInterceptor.setCountSqlParser(JsqlParserCountOptimize(true))
        return paginationInterceptor
    }
}